Implement TypeScript client for OpenHands Agent Server #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements a complete TypeScript client for the OpenHands Agent Server that mirrors the structure and functionality of the Python SDK (
software-agent-sdk). The client provides the same classes and parameter names as the Python version for consistency across language implementations.Key Features
🏗️ Core Architecture
📡 API Coverage
agent-sdk.json🔧 Developer Experience
examples/basic-usage.tsImplementation Details
Class Structure (Mirrors Python SDK)
Type Safety
WebSocket Integration
Files Added
Source Code
src/types/base.ts- Core TypeScript interfaces and enumssrc/client/http-client.ts- HTTP client implementationsrc/events/- WebSocket client and event managementsrc/conversation/- RemoteConversation and RemoteState classessrc/workspace/remote-workspace.ts- Workspace operationssrc/models/- Data models for API requests/responsessrc/index.ts- Public API exportsConfiguration
package.json- Dependencies and build scriptstsconfig.json- TypeScript compiler configuration.eslintrc.js- ESLint rules and TypeScript integration.prettierrc- Code formatting rules.gitignore- Git ignore patternsDocumentation & Examples
README.md- Comprehensive API documentation and usage guideexamples/basic-usage.ts- Complete usage examplesTesting & Quality
✅ TypeScript Compilation: All code compiles successfully without errors
✅ ESLint Validation: Passes linting with only acceptable warnings for
anytypes✅ Import/Export: All modules import and export correctly
✅ Build System: Generates proper JavaScript output with type declarations
Usage Example
Dependencies
Runtime Dependencies
ws- WebSocket client implementationuuid- UUID generation for request trackingDevelopment Dependencies
typescript- TypeScript compiler@typescript-eslint/*- TypeScript ESLint integrationeslint- Code lintingprettier- Code formattingjest- Testing framework (configured for future tests)Future Enhancements
Breaking Changes
None - this is a new implementation.
Migration Guide
For users coming from the Python SDK, the API is nearly identical:
The main differences are TypeScript-specific (type annotations,
constvslet, etc.) and JavaScript conventions (camelCase method names in some cases).@rbren can click here to continue refining the PR